package com.acerola.downloader;

import com.acerola.downloader.core.Downloader;

import java.util.Scanner;

/**
 * @program: MultithreadedDownloader
 * @description: 程序入口
 * @author: Acerola
 * @create: 2022-05-10 19:46
 **/
public class Main {
    public static void main(String[] args) throws InterruptedException {

        String url = null;
        if (args == null || args.length == 0) {
            while (true) {
                System.out.println("请输入下载链接:");
                Scanner scanner = new Scanner(System.in);
                url = scanner.next();
                if (url != null) {
                    break;
                }
            }
        } else {
            url = args[0];
        }
        long startTime = System.currentTimeMillis();
        Downloader downloader = new Downloader();
        downloader.downloader(url);
        long endTime = System.currentTimeMillis();
        System.out.println("下载花费了"+(endTime - startTime)/1000+"s");
    }
}
